1. Field of the Invention
This invention relates to an inspection system for detecting edges of an inspection object in image data provided by an image pickup machine for imaging the inspection object, thereby measuring the size of the inspection object, for example, the external or internal dimension thereof and arrangement pitches of pins, or the like, arranged at equal intervals, and to an image edge detection method on which such inspection is predicated. It also relates to a recording medium recording therein a computer program for realizing such an inspection system on a general-purpose computer.
2. Description of the Related Art
An inspection system has already come into common use, wherein a product moving on a manufacturing line is imaged by an image pickup machine as an inspection object, which will be hereinafter referred to as a workpiece, and image data provided by picking up the image is processed to find the feature amounts thereof, thereby conducting various inspections on the workpiece, for example, determining whether or not the shape of the workpiece is good, dimensional accuracy, whether or not surface discontinuity exists, and whether or not painting or printing is good. The inspection of the dimensional accuracy requires processing of detecting edges from the image data and locating the positions of the edges. Two or more edges are specified on the screen displaying the detected edges and the inspection system is caused to measure the distance therebetween, whereby the inspection purpose is accomplished; at the time, the edges are specified on the screen by the operator with a pointer or a window is set so as to contain the target edges.
On the other hand, to detect edges in the image data as a prerequisite for the inspection as described above, the operator needs to set sensitivity. The sensitivity described here refers to the sensitivity to be set for detecting edges in response to the lightness difference in the image data, namely, is a value as a threshold value of the lightness difference between pixels in actual data processing. Therefore, the operator causes the inspection system to pick up an image of a workpiece and detect edges in a state in which one sensitivity is set. If the result is improper, the operator changes the setup sensitivity, then again causes the inspection system to pick up an image of the workpiece and detect edges; the operator repeats the operation sequence. After edges are properly detected, the operator specifies the edges to be-measured on the screen and causes the inspection system to execute final measurement, for example, measurement of the external and internal dimensions of the workpiece and pitches.
Thus, with the conventional inspection system, whenever edges are not detected properly, it is necessary to change the setup sensitivity and again pick up an image of the inspection object; the time required for the inspection is prolonged. After edges are detected properly, still the operator needs to specify which edges are to be inspected, thus the work is intricate and is hard to carry out for a beginner.
It is therefore an object of the invention to provide an inspection system for enabling edge detection based on different sensitivities simply by once picking up an image of a workpiece and minimizing edge specification required for inspection for improving convenience of operation, an edge detection method, and a recording medium recording therein a computer program for realizing such an inspection system on a general-purpose computer.
In order to achieve the above object, according to a first aspect of the invention, there is provided an image edge detection method comprising: a first step of storing image data provided by picking up an image of an inspection object in storage means; a second step of displaying the image data stored in the storage means on a display screen with pixels arranged in an X-axis direction and a Y-axis direction perpendicular to the X-axis direction; a third step of setting an edge detection range with four sides along the X- or Y-axis direction on the display screen; a fourth step of integrating values concerning lightness values of pixels with respect to each pixel string arranged in the Y- or X-axis direction in the setup detection range; and a fifth step of detecting as an edge a position in the X- or Y-axis direction corresponding to a maximum value of a portion where an absolute value of a differential operation result in the X- or Y-axis direction, of the integration result of the values concerning the lightness values is equal to or greater than a threshold value.
According to a second aspect of the invention, there is provided an inspection system for detecting edges according to a threshold value set from an outside in an edge detection range set on an image of an inspection object displayed on a display screen of a display unit and inspecting the inspection object based on the detected edges, wherein if the threshold value is changed, edge detection is again executed according to a new setup threshold value and the edge detection result is displayed on the display screen of the display unit.
According to a third aspect of the invention, there-is provided an inspection system for measuring the distance between two edges nearest to both end parts in an X- or Y-axis direction, of edges detected in an edge detection range set on an image of an inspection object displayed on a display screen of a display unit as an external dimension of the inspection object.
According to a fourth aspect of the invention, there is provided an inspection system, if the number n of edges detected in an edge detection range set on an image of an inspection object displayed on a display screen of a display unit is even, for measuring the distance between a (n/2)-th edge from one end in an X- or Y-axis direction and a next edge as an internal dimension of the inspection object or if the number n of edges detected in the edge detection range is odd, for measuring the distance between a {(nxe2x88x921)/2}-th edge from one end in the X- or Y-axis direction and a next edge or between a {(n+1)/2}-th edge from one end in the X- or Y-axis direction and a next edge as the internal dimension of the inspection object.
According to a fifth aspect of the invention, there is provided an inspection system, if one end of an edge detection range in an X- or Y-axis direction thereof set on an image of an inspection object comprising a plurality of bar-like patterns arranged in parallel in the X- or Y-axis direction, displayed on a display screen of a display unit is placed out of the bar-like pattern, with the area between each (odd number)-th edge from the one end side of the edge detection range and a next edge as a pattern image, the inspection system for measuring the width of each pattern and the distance between centers of the patterns, or if one end of the edge detection range in the X- or Y-axis direction is placed on one bar-like pattern, with the area between each (odd number)-th edge from the one end side of the edge detection range and a next edge as a gap image between patterns, the inspection system for measuring the width of each gap and the distance between centers of the gaps.
According to a sixth aspect of the invention, there is provided an inspection system comprising: storage means for storing image data provided by picking up an image of an inspection object; display means for displaying the image data stored in the storage means on a display screen with pixels arranged in an X-axis direction and a Y-axis direction perpendicular to the X-axis direction; detection range setting means for setting an edge detection range with four sides along the X- or Y-axis direction on the display screen of the display means; and edge detection means for integrating values concerning lightness values of pixels with respect to each pixel string arranged in the Y- or X-axis direction in the detection range set by the detection range setting means and detecting as an edge a position in the X- or Y-axis direction corresponding to a maximum value of a portion where an absolute value of a differential operation result in the X- or Y-axis direction, of the integration result is equal to or greater than a threshold value.
According to a seventh aspect of the invention, there is provided a recording medium recording therein a computer program for causing a computer to detect edges from image data provided by picking up an image of an inspection object, the computer program comprising: first computer-readable program code means for causing the computer to store the image data provided by picking up the image of the inspection object; second computer-readable program code means for causing the computer to display the stored image data on a display screen with pixels arranged in an X-axis direction and a Y-axis direction perpendicular to the X-axis direction; third computer-readable program code means for causing the computer to set an edge detection range with four sides along the X- or Y-axis direction on the display screen; fourth computer-readable program code means for causing the computer to integrate values concerning lightness values of pixels with respect to each pixel string arranged in the Y- or X-axis direction in the setup detection range; and fifth computer-readable program code means for causing the computer to detect as an edge a position in the X- or Y-axis direction corresponding to a maximum value of a portion where an absolute value of a differential operation result in the X- or Y-axis direction, of the integration result of the values concerning the lightness values is equal to or greater than a threshold value.